using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using FlatRedBall;
using FlatRedBall.Graphics;
using FlatRedBall.Input;
using Like_a_bomberman.Screens;



namespace Like_a_bomberman
{
      
    
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Bomba : GameComponentCollision
    {
      
        float x0, y0;
        float tiempo_de_explocion = 0;
        bool explosion = false;
        

        public Bomba(Game game, float x0, float y0)
            : base(game, 2)
        {
            this.x0 = x0;
            this.y0 = y0;

            // TODO: Construct any child components here


        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            

            sprite = SpriteManager.AddSprite("Bomba.png");
            sprite.X = x0;
            sprite.Y = y0;

            sprite.XVelocity = 0;
            sprite.XAcceleration = 0;
            sprite.YAcceleration = 0;
            sprite.YVelocity = 0;

            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            tiempo_de_explocion = tiempo_de_explocion + 1;

            if (tiempo_de_explocion == 150)
            {
                sprite.Visible = false;
                for (int i = 0; i < 4; ++i)
                {
                    Explosion explosion = new Explosion(this.Game, sprite.X + 50 * i, sprite.Y + 50 * i);
                    this.Game.Components.Add(explosion);
                }

                    
               


            }




            // TODO: Add your update code here

            

            base.Update(gameTime);
        }
    }
}
